package com.gem.talkbase.widget;  
  
import com.gem.talkbase.activity.LoginActivity;
import com.gem.talkbase.activity.RegisterActivity;
import com.gem.talkbase.constant.Constants;

import android.app.Activity;  
import android.view.ViewGroup;
import android.view.animation.Animation;  
  
public class DisplayNextView implements Animation.AnimationListener {  
  
    Object obj;  
    ViewGroup mTranslateLayoutContainer;

    Activity ac;  
    int order;  
  
    public DisplayNextView(Activity ac, int order) {  
        this.ac = ac;  
        this.order = order;  
    }  
  
    public void onAnimationStart(Animation animation) {  
    }  
  
    public void onAnimationEnd(Animation animation) {  
        doSomethingOnEnd(order);  
    }  
  
    public void onAnimationRepeat(Animation animation) {  
    }  
  
    private final class SwapViews implements Runnable {  
        public void run() {  
            switch (order) {  
            case Constants.KEY_FIRST_INVERSE:  //1
                ((LoginActivity) ac).jumpToSecond();  //带参数First(登录--->注册)
                break;  
            case Constants.KEY_SECOND_CLOCKWISE:  //4
                ((RegisterActivity) ac).jumpToFirst();  //带参数Second(注册--->登录)
                break;  
            }  
        }  
    }  
  
    public void doSomethingOnEnd(int _order) {  
        switch (_order) {  
        case Constants.KEY_FIRST_INVERSE:  //1
            ((LoginActivity) ac).mTranslateLayoutContainer.post(new SwapViews());  
            break;  
  
        case Constants.KEY_SECOND_CLOCKWISE:  //4
            ((RegisterActivity) ac).mSecondContainer.post(new SwapViews());  
            break;  
        }  
    }  
}  
